<template>
	<view>
		<view class="head-view flex-cfs">
			<image class="head-img" src="../../static/temp/cate10.jpg" mode=""></image>
			<view class="mar-l20 head-text">
				描述
			</view>
			<view class="flex-cc mar-l20">
				<text class="qxicon iconstar" :class="points>0?'yes':'no'" @click="setPoints(points==1?0:1)" ></text>
				<text class="qxicon iconstar" :class="points>1?'yes':'no'" @click="setPoints(points==2?1:2)"></text>
				<text class="qxicon iconstar" :class="points>2?'yes':'no'" @click="setPoints(points==3?2:3)"></text>
				<text class="qxicon iconstar" :class="points>3?'yes':'no'" @click="setPoints(points==4?3:4)"></text>
				<text class="qxicon iconstar" :class="points>4?'yes':'no'" @click="setPoints(points==5?4:5)"></text>
			</view>
		</view>
		
		<view class="cu-form-group margin-top">
			<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaAInput" placeholder="多行文本输入框"></textarea>
		</view>
		
		<view class="cu-bar bg-white margin-top">
			<view class="action">
				图片上传
			</view>
			<view class="action">
				{{imgList.length}}/3
			</view>
		</view>
		<view class="cu-form-group">
			<view class="grid col-4 grid-square flex-sub">
				<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
				 <image :src="imgList[index]" mode="aspectFill"></image>
					<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
						<text class='cuIcon-close'></text>
					</view>
				</view>
				<view class="solids" @tap="ChooseImage" v-if="imgList.length<3">
					<text class='cuIcon-cameraadd'></text>
				</view>
			</view>
		</view>
		
		
		<view class="padding flex flex-direction">
			<button class="cu-btn sub-but lg">发布</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				modalName: null,
				points:0,
				imgList:[],
				textareaAValue:'',
			}
		},
		methods: {
			setPoints(num){
				this.points = num;
				console.log(this.points);
			},
			textareaAInput(e) {
				this.textareaAValue = e.detail.value
			},
			ChooseImage() {
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
					}
				});
			},
		}
	}
</script>

<style>
	.head-view{
		background-color: #FFFFFF;
		padding: 20upx;
	}
	.head-img{
		width:80upx;
		height:80upx;
		border-radius:8upx;
	}
	.head-text{
		font-size:28upx;
		font-weight:600;
		color:rgba(60,60,60,1);
		line-height:40upx;
	}
	.no{
		color: #B4B4B4;
	}
	.yes{
		color: #F59126;
	}
	.sub-but{
		background-color: #FFA800;
		color: #FFFFFF;
	}
</style>
